package com.token.iot.bratterycharging.gateway.business;

import java.util.HashMap;

import org.springframework.stereotype.Component;

import com.outstanding.framework.base.SpringContextHolder;
import com.outstanding.framework.core.Logger;
import com.outstanding.framework.core.PendingException;
import com.outstanding.framework.log.LoggerFactory;
import com.token.iot.bratterycharging.gateway.AbstractOper;
import com.token.iot.bratterycharging.gateway.IDGeneration;
import com.token.iot.bratterycharging.gateway.IMEI;
import com.token.iot.bratterycharging.gateway.Oper;

import io.netty.channel.ChannelHandlerContext;


/**
 * 线下刷卡消费上报
 * @author chenzhixuan
 *
 */
@Component("USKOper")
public class USKOper extends AbstractOper{
	
	
	
	private static Logger loger = LoggerFactory.getLogger("transactionLogger");
	
	
	@Override
	public int onCall(byte[] b,ChannelHandlerContext ctx) throws PendingException {
		String val = new String(b);
		loger.info(" the UTB response =" + val);
		String imei = IMEI.getIMEI(ctx);
		String sessionid = IDGeneration.getSessionID(b);
		String  left = val.substring(14);
		String[] params = left.split("#/#");
		for(int i=0;i<params.length;i++) {
			String str = params[i];
			loger.debug(str);
		}
		return 0;
	}

}
